import random

import matplotlib.pyplot as plt

x = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180]
y1 = [64.2, 64.34, 64.52, 64.47, 63.90, 62.88, 61.01, 61.35, 61.29, 60.77, 60.91, 60.99, 60.31, 60.22, 60.12, 60.72, 60.08, 60.56, 60.02]
y2 = [i + random.uniform(-0.5, 0.5) for i in y1]
y3 = [i + random.uniform(-0.7, 0.3) for i in y1]
y4 = [64.1 for _ in range(19)]

y = [y1, y2, y3, y4]
# y = []
# for i in range(3):
#     y.append([random.uniform(20, 66) for _ in range(19)])

cat = ['θ=0.2', 'θ=0.5', 'no cutout', 'no rotated mosaic']

# 绘制折线图，添加数据点，设置点的大小
# * 表示绘制五角星；此处也可以不设置线条颜色，matplotlib会自动为线条添加不同的颜色
for i in range(len(y)):
    plt.plot(x, y[i], markersize=10)
# plt.plot(x, y2, marker='*', markersize=10)

# plt.title('温度对比折线图')  # 折线图标题
plt.xlabel('rotation angle')  # x轴标题
plt.ylabel('mAP')  # y轴标题
# 给图像添加注释，并设置样式
# for i in range(len(y)):
#     for a, b in zip(x, y[i]):
#         plt.text(a, b, b, ha='center', va='bottom', fontsize=10)

# for i in range(len(y)):
#     plt.text(x[i], y[i][i], cat[i], ha='center', va='bottom', fontsize=10)


# 绘制图例
plt.legend(cat)
# 显示图像
plt.show()
